﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>หน้ารวมผู้ใช้งาน</title>
</head>
<style>
#header{
  height: 32px;
  margin-right: 20px;
  margin-left: 2px;
}

#header_titile{
  float: left;
}

#main{
  width:800px;
  margin: 0 auto 0 auto;
  border: 1px solid #E5E5E5;
  padding: 26px 24px 46px;
}

#user_info{
  float: right;
  font-size: 14px;
  /*line-height: 26px;*/
  height: 25px;
  position: relative;
/*  z-index: 49; */
  border-style: solid;
  border-width: 0;
  /* margin-top: 3px; */
  padding: 0 2px 0 6px;
  display:block;
}

body{
  font-family:tahoma;
  font-size:14px; 
}
</style>
<script type="text/javascript">
checked=false;
function checkAll(a_form)
{
    var aa = document.getElementById(a_form);
    if (checked == false)
      checked = true
    else
      checked = false
    for (var i =0; i < aa.elements.length; ++i) 
    {
      aa.elements[i].checked = checked;
    }
}
</script>

<body>
<div id="main">
<div id="header" >
<a href="<?php echo site_url('plant') ?>">แก้ไขฐานข้อมูลโรงควบคุม</a> - ข้อมูลโรงควบคุม
<div id="user_info">สวัสดีคุณผู้ใช้ <?php echo $_SESSION['username']; ?><?php echo " (".$_SESSION['user_level'].")"; ?> <a href="<?php echo site_url('webadmin/logout') ?>">ออกจากระบบ</a></div>
</div>

<p>
<h3>โรงควบคุม <?php echo $plantname; ?></h3>
 <?php 
  $form_id = array("id" => "myform");
  echo form_open("plant/delete_year/".$pid, $form_id); 

  $bool = ($_SESSION['user_level'] != "reader");
  if ($bool == TRUE)
  {
      echo "<input type='submit' id='delete' value='ลบ' onclick=\"javascript:return confirm('delete?')\" /> ";
      echo "<a href=".site_url('plant/add_year/'.$pid).">เพิ่มปี</a>";
  }
 ?>
</p>
<table border="1" cellspacing="0">
  <tr >
    <th width="20">
        <input type="checkbox" name='checkall' onclick="checkAll('myform')" />
    </th>
    <th width="200">ปี</th>
    <th width="500">เดือน</th>
  </tr>
  <?php 
    if (count($rs) == 0)
    {
      echo "<tr><td>NA</td>";
      echo "<td>no data</td>";
      echo "<td>no data</td>";
    }
    else
    {
      $no = 1;
      foreach ($rs as $row) {
        
        $year = intval($row->year);
        $year = $year - 543;

        echo "<tr>";
          echo "<td><input type='checkbox' name='mycheckbox[]' value='".$row->yid."' /></td>";
          echo "<td>".$row->year."</td>";
          echo "<td>คุณภาพน้ำ : ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-01-01");
            echo "' >ม.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-02-01");
            echo "' >ก.พ.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-03-01");
            echo "' >มี.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-04-01");
            echo "' >เม.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-05-01");
            echo "' >พ.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-06-01");
            echo "' >มิ.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-07-01");
            echo "' >ก.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-08-01");
            echo "' >ส.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-09-01");
            echo "' >ก.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-10-01");
            echo "' >ต.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-11-01");
            echo "' >พ.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_quality/'.$pid."/".$row->yid."/".strval($year)."-12-01");
            echo "' >ธ.ค.</a> ";
            
            
            echo "<br/>อัตราการไหล : ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."01-01");
            echo "' >ม.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."02-01");
            echo "' >ก.พ.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."03-01");
            echo "' >มี.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."04-01");
            echo "' >เม.ษ.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."05-01");
            echo "' >พ.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."06-01");
            echo "' >มิ.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."07-01");
            echo "' >ก.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."08-01");
            echo "' >ส.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."09-01");
            echo "' >ก.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."10-01");
            echo "' >ต.ค.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."11-01");
            echo "' >พ.ย.</a> ";
            echo "<a href='";
            echo site_url('plant/update_flow/'.$pid."/".$row->yid."/".strval($year)."-"."12-01");
            echo "' >ธ.ค.</a> ";
          echo "</td>";
        echo "<tr>";
        ++$no;
      }
    }
  ?>
</table>

<p>
<?php
  if ($bool == TRUE)
  {
      echo "<input type='submit' id='delete' value='ลบ' onclick=\"javascript:return confirm('delete?')\" /> ";
      echo "<a href=".site_url('plant/add_year/'.$pid).">เพิ่มปี</a>";
  }
 ?>
<?php echo form_close(); ?>
</p>

</div>
</body>
</html>
